package com.cly.user;

import com.cly.entity.Permission;
import com.cly.entity.Router;
import com.cly.result.JsonRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 权限远程调用接口
 *
 * @author by 春风能解释
 * <p>
 * 2024/6/6
 */
@FeignClient(value = "smart-village-user",
        path = "/permission",
        contextId = "permissionFeign")
public interface PermissionFeign {
    /**
     * 根据用户ID检索该用户的权限列表
     *
     * @param userId 用户ID
     * @return JSON
     */
    @GetMapping("/user")
    JsonRequest<List<Permission>> lookPermissionByUser(@RequestParam Long userId);

    /**
     * 根据路由查询权限表信息
     *
     * @param router 路由信息
     * @return JSON
     */
    @GetMapping("/router")
    JsonRequest<List<Permission>> lookPermissionByRouter(Router router);
}
